﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<title>我的订单-个人中心-PHPmall</title>
	<meta name="Copyright" content="{$confRes.miaoshu}"/>
	<meta name="Keywords" content="{$confRes.sitename}"/>
	<meta name="Description" content="{$confRes.miaoshu}"/>
	<link rel="stylesheet" type="text/css" href="/static/index/css/page.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/pc-error.6583439e.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/pc-jifen-buy-process.c1a2f440.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/pc-personal-order.6f6355da.css">
	<link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
	<script src="/static/layer/jquery.min.js"></script>
	<script src="/static/layer/layer.js"></script>
</head>
<body>
<div id="header" class="header">
	<!--个人状态-->
	{include file="index@public/topmenu"}
	<!--个人状态end-->
	<!--导航栏-->
	{include file="index@public/topnav"}
	<!--导航栏end-->

</div>

<div class="content">
	<div class="personal">
		<div class="personal-header">
			<h2 class="title">个人中心 - 我的订单</h2>
		</div>
		<div class="personal-body">
				{include file="public/mem_menu"}
			<div class="personal-main">

				<div class="personal-main" {if $count == 0} {else} style="display: none" {/if}>
					<div class="order-body">
						<div class="order-status-tips">
							<p>亲，你暂时没有下单哦，去逛逛吧~</p>

							<div class="buttons choices">
								<a href="/">
									<button type="button" class="btn btn-big btn-light-green">去逛逛</button>
								</a>
							</div>
						</div>
					</div>
				</div>

				<div class="orders pending" {if $count != 0} {else} style="display: none" {/if}>
					<div class="orders-header">
						<p class="orders-header-title">全部订单</p>
						<table class="orders-header-table">
							<thead>
							<tr>
								<th class="order-info">商品信息</th>
								<th class="order-price">实付款（元）</th>
								<th class="order-price">关闭时间</th>
								<th class="order-operate">操作</th>
							</tr>
							</thead>
						</table>
					</div>
					{volist name="order" id="vo_order"}
					<div class="order order-detail">
						<div class="order-header">
							<p class="order-date num">{$vo_order.create_time}</p>
							<p class="order-code">订单编号：<span class="num">{$vo_order.order_id}</span></p>
							<p class="order-status">
								{switch $vo_order.status }
								{case 1 }
								<span class="green">待付款</span>
								{/case}
								{case 2}
								<!--订单状态。1、未付款 2、已付款 3、未发货  4、已发货 5、交易成功 6、交易关闭-->
								<span class="green" style="color:#28ac17;">付款成功</span>
								{/case}
								{case 3}
								<span class="green">未发货</span>
								{/case}
								{case 4}
								<span class="green">已发货</span>
								{/case}
								{case 5}
								<span class="green">交易成功</span>
								{/case}
								{case 6}
								<span class="green">取消订单</span>
								{/case}
								{default /}默认情况
								{/switch}
							</p>

						</div>
						<table class="order-detail-table clearfix">
							<thead>
							<tr>
								<th class="order-info">商品信息</th>
								<th class="order-price">实付款（元）</th>
								<th class="order-price">关闭时间</th>

								<th class="order-operate">操作</th>
							</tr>
							</thead>
							<tbody>
							<tr>
								<?php $goods = json_decode($vo_order['goods_item']) ;?>
								<?php $address = json_decode($vo_order['address']) ;?>
								<td class="order-info">
									<div class="product cf">
										{volist name="goods" id="vo_goods"}
										<?php $goodsss = $vo_goods->goods?><br>
										<?php $id = ($goodsss->id);?>
										<a href="{:url('index/Goods/index',array('id'=>$id))}" ><img width="50" style="float: left" src="/static/uploads/<?php echo $goodsss->og_thumb?>" alt="<?php echo $address->name;?>"></a>
										{/volist}
									</div>
								</td>

								<td class="order-price" rowspan="2">
									<p class="order-price-num num">￥{$vo_order.payment}</p>
									<p class="order-price-ship">
										（包邮）
									</p>
								</td>
								<td class="order-price" rowspan="2">
									{switch $vo_order.status }
									{case 1 }
									<span class="close endtime" value="<?php echo ($vo_order['close_time']);?>"></span>
									{/case}
									{case 2}
									<!--订单状态。1、未付款 2、已付款 3、未发货  4、已发货 5、交易成功 6、交易关闭-->
									<span class="green">付款成功</span>
									{/case}
									{case 3}
									<span class="green">未发货</span>
									{/case}
									{case 4}
									<span class="green">已发货</span>
									{/case}
									{case 5}
									<span class="green">交易成功</span>
									{/case}
									{case 6}
									<a class="blue">订单关闭</a>
									{/case}
									{default /}默认情况
									{/switch}
								</td>
								<td class="order-operate" rowspan="2">
									{switch $vo_order.status }
									{case 1 }
									<a href="{:url('user/order/showOrder',array('id'=>$vo_order.order_id))}" class="order-operator btn go-pay btn-normal btn-green">去支付</a>
									<p><a style="cursor: pointer" class="order-operator cancel" onclick="cancelOrder('{$vo_order.order_id}')" >取消订单</a></p>
									{/case}
									{case 2}
									<!--订单状态。1、未付款 2、已付款 3、未发货  4、已发货 5、交易成功 6、交易关闭-->
									<span class="green">付款成功</span>
									{/case}
									{case 3}
									<span class="green">未发货</span>
									{/case}
									{case 4}
									<a class="green" style="cursor: pointer" onclick="x_admin_show('物流信息','{:url(\'user/user/logisticsInfo\')}?id='+{$vo_order.id},600,600)">查看物流信息</a>
									{/case}
									{case 5}
									<a class="green" style="cursor: pointer" onclick="x_admin_show('物流信息','{:url(\'user/user/logisticsInfo\')}?id='+{$vo_order.id},600,600)">交易成功</a>

									{/case}
									{case 6}
									<a class="blue">交易关闭</a>
									{/case}
									{default /}默认情况
									{/switch}
									<br><a href="{:url('user/order/show_Order',array('id'=>$vo_order.order_id))}" target="_blank" class="gray">订单详情</a>
								</td>
							</tr>
							</tbody>
						</table>
					</div>
					{/volist}
				</div>
				<div class="page">
					{$order|raw}
				</div>
			</div>
		</div>
	</div>
</div>



<!--尾部-->
{include file="index@public/footer"}
<!--尾部end-->
<script type="text/javascript" src="/static/index/js/c22559310a7b450cbe60c70169dd1d6f.js" charset="UTF-8"></script>

<script type="text/javascript" src="/static/index/js/midaslogdata.3586e7e2.js"></script>
<script>
    function x_admin_show(title,url,w,h){
        if (title == null || title == '') {
            title=false;
        };
        if (url == null || url == '') {
            url="404.html";
        };
        if (w == null || w == '') {
            w=($(window).width()*0.9);
        };
        if (h == null || h == '') {
            h=($(window).height() - 50);
        };
        layer.open({
            type: 2,
            area: [w+'px', h +'px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade:0.4,
            title: title,
            content: url
        });
    }

    $(function(){
        setInterval(function(){
            $(".endtime").each(function(){
                var obj = $(this);
                var endTime = obj.attr('value');
                var timestamp = Date.parse(new Date());
                var nMS= (endTime-(timestamp/1000)) * 1000;
                var myD=Math.floor(nMS/(1000 * 60 * 60 * 24)); //天
                var myH=Math.floor(nMS/(1000*60*60)) % 24; //小时
                var myM=Math.floor(nMS/(1000*60)) % 60; //分钟
                var myS=Math.floor(nMS/1000) % 60; //秒
                if(myD>= 0){
                    var str = myD+"天"+myH+"小时"+myM+"分"+myS+"秒";
                }else{
                    var str = "订单关闭！";
                }
                obj.html(str);
            });
        }, 1000); //每个0.1秒执行一次
    });
    // 取消订单

    function cancelOrder(order_id){
        layer.confirm('确定要取消此订单吗？',function(index){
            $.ajax({
                url:"{:url('user/order/cancelOrder')}",
                type:"POST",
                dataType:"json",
                data:{
                    order_id:order_id
                },
                success:function (res) {
                    if(res == 1){
                        layer.alert('订单取消成功',function () {
                            window.location.reload();  //刷新父级页面
                        });
                    }
                }
            });
		});


    }
</script>

<script type="text/javascript" src="/static/index/js/order.f859174f.js"></script>
</body>
</html>
